<%@page import="com.sinodata.bsm.common.constants.SystemParameterConstants"%>
<%@page import="com.sinodata.bsm.common.vo.SystemParameter"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>config-parameter-view</title>
    <%@ include file="../include/common.jsp"%>
	<%@ include file="../include/jbox.jsp"%>
	<%@ include file="../include/table.jsp"%>
	<script type="text/javascript">
	
	function update(){
		$.ajax({
			   type: "POST", 
			   url: "${pageContext.request.contextPath}/config/config!updateParameter.action", //请求的action
			   data: $("#myform").serialize(), //传的参数
			   dataType: 'json',
			   success: function(data){ //结果
				   getTopWin(window).getMessageBox().tip('保存成功', 'success',{timeout: 1000});
			   }
		});
	}
	
	function cancelAllCheck(){
		$("#dt_check_all").removeAttr("checked");
	}
	 //全选和取消全选
   function allClick(isSigle)
	    {
	    	if(isSigle!=1) //如果是单选就不支持全选
  	    	{
  	    		var dt_check_all = $('#dt_check_all').attr("checked");
	  	    	var allCheckbox = $("input[name='dt_check']");
	  	    	if(dt_check_all)
	  	    	{
	  	    		
	  	    		allCheckbox.attr("checked",allCheckbox);  //全选
	  	    		$('#viewList tbody tr').addClass('row_selected');  //背景色全选
	  	    	}else
	  	    	{
	  	    		allCheckbox.attr("checked",false);   //取消全选
	  	    		$('#viewList tbody tr').removeClass('row_selected');  //背景色取消
	  	    	}
  	    	}
	    }
	
		$('#viewList tbody td :checkbox').live('click', function (e) {
			
		});
	</script>
  </head>
  
  <body>
  <h2 class="title-h2" style="margin-top:0; "><span><img src="${pageContext.request.contextPath}/style/default/bsm/images/arrow-down.gif"/></span>系统参数列表</h2>
	<div class="toolbar" id = "toolbar">
		<a class="page_add" href="javascript:update();" >保存</a>
	</div>
	
	<div>
		<form action="" id="myform" name="myform" method="post">
			<table id="parameterList" width="100%" cellpadding="0" cellspacing="0" border="0" class="display">
				<tbody>
				<%List<SystemParameter> systemParameters = (List<SystemParameter>)request.getAttribute("allParameters");
					if(systemParameters!=null&&systemParameters.size()>0){
						for(SystemParameter e:systemParameters){
				%>
					<tr>
						<%if(e.getValue().equals("1")){ %>
							<td width="2%"><input type="checkbox" value="1" checked="checked" name="<%=e.getKey()%>"/></td>
						<%}else{ %>
						   <td width="2%"><input type="checkbox" value="1" name="<%=e.getKey()%>"/></td>
						<%} %>
						<td><%=SystemParameterConstants.getSystemParameterDesc(e.getKey()) %></td>
					</tr>
				<%}} %>
				</tbody>
			</table>
		</form>
	</div>
  </body>
</html>
